<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" %>
<%@ page import="net.sf.ehcache.*"%>
<jsp:useBean id="cache" type="net.sf.ehcache.Cache" scope="application"/>
<%
	String s_count = request.getParameter("count");
	if(s_count == null || s_count.length()==0)
		s_count = "5000";
%>
<form>
	Performance Test：
	<input type='text' name='count' value='<%=s_count%>' size='5'/>
	<input type='submit' name='action' value='Begin'/>
</form>
<%
	String action = request.getParameter("action");
	int test_count = Integer.parseInt(s_count);
	if(action!=null && action.length()>0){
		long st = System.currentTimeMillis();
		for(int i=0;i<test_count;i++){
			String key = "key:"+i;
			cache.remove(key);
			Element obj = new Element(key,String.valueOf(i));
			cache.put(obj);
		}
		long time = System.currentTimeMillis() - st;
		out.println("Cache Write " + test_count + " times in " + time + "ms");
	}
%>
<p><a href="index.jsp">Back to Index</a></p>